<?php 
/*<extend>*/ 
$direct=$_GET['direct'];   
define( 'NV_MAINFILE' ,'1');
require_once "config.php";
$link = mysql_connect($db_config['dbhost'], $db_config['dbuname'], $db_config['dbpass'] );
if (!$link) {die('Could not connect: ' . mysql_error());}
$db_selected = mysql_select_db($db_config['dbname'], $link);
if (!$db_selected) {die ('Can\'t use db : ' . mysql_error());}
mysql_set_charset('utf8',$link); 
$query="SELECT * FROM nv3_shops_rows WHERE focus='1'  ORDER BY RAND()";
$result=mysql_query($query);
if(!$result) return;
?>       

<?php if(mysql_num_rows($result)>5){?>                   
<script type="text/javascript" src="/js/sagscroller/sagscroller_<?php echo $direct?>.js"></script>
<script>
    var sagscroller_<?php echo $direct;?> =new sagscroller({
        id:'mysagscroller_<?php echo $direct;?>',
        mode: 'auto',
        pause: 2500,
        animatespeed: 400
    })      
</script>
<?php } ?>   

<div class='extend_banner'></div>
<div class='image'>
    <div id="mysagscroller_<?php echo $direct;?>" class="sagscroller">
        <ul>
<?php
while($row=mysql_fetch_assoc($result))
{
	$tmp=$row['homeimgthumb'];
	$tmp=explode('|',$tmp);
	$homeimgthumb=$tmp[0];
	$vi_alias=$row['vi_alias'];
	$vi_title=$row['vi_title'];
	$id=$row['id'];
?>          
    <li >
        <p> 
		    <a href='/index.php/vi/shops/<?php echo $cats[$listcatid];?>/<?php echo $vi_alias;?>-<?php echo $id?>/'>
			    <img src='/uploads/shops/<?php echo $homeimgthumb;?>'/>
			    <span><?php echo $vi_title;?></span>
		    </a>
	    </p>
    </li>
<?php
}
?>
        </ul>
     </div>   
</div>   

<?php
mysql_close($link);      
/*</extend>*/
?>

